<extend name="common:commonTemplate" />

<block name="main_content">
<div class="content2">
    <div class="pwdbox">
        <div class="pwd_form error"><input id="txt_old_pwd" type="password" class="pwd_input2" placeholder="原始密码"/></div>
        <div class="pwd_form"><input id="txt_new_pwd" type="password" class="pwd_input2" placeholder="新密码"/></div>
        <div class="pwd_form"><input id="txt_new_pwd2" type="password" class="pwd_input2" placeholder="确认新密码"/></div>
        <a href="javascript:;" class="hbtn">提 交</a>
    </div>
</div>
<div class="fixnav">
    <a href="/admin/home" class=""><img src="/Public/images/menu_01.png" alt=""/><span>首页</span></a>
    <a href="/order/orderlist" class="focus"><img src="/Public/images/menu_02.png" alt=""/><span>所有订单</span></a>
    <a href="/promoter/center"><img src="/Public/images/menu_03.png" alt=""/><span>个人中心</span></a>
</div>
</block>

<block name="inner_script">
<script type="text/javascript">
 (function () {
        document.documentElement.style.fontSize = (document.body.offsetWidth/320) * 14 + 'px';
    })();
 
$(document).ready(function(){
	$('.hbtn').bind('click', function(){
		var promoter_id = $('#myaccount').attr('promoter_id');
		var old_pwd = $('#txt_old_pwd').val();
		var new_pwd = $('#txt_new_pwd').val();
		var new_pwd2 = $('#txt_new_pwd2').val();
		
		var result = PromoterService.UpdatePwd(promoter_id, old_pwd, new_pwd, new_pwd2);
		
		if(result.IsSuccess == 0){
			alert(result.ErrorMsg);
			return;
		}
		else{
			alert("密码修改成功");
			var result = AdminService.Logout();
    		if(result.IsSuccess == 0){
    			alert(result.ErrorMsg);
    			return;
    		}
    		else{
    			location.reload();
    		}
		}
	});
});
</script>
</block>